<template>

	<layout :loading="true" curPage="home" >
		
	</layout>

</template>

<script>
	export default {
		data() {
			return {
				loading : true 
			}
		},
		onLoad: function(e){
			
		},
		onShow() {
			this.redirectByMenu();
		},
		methods: {
			redirectByMenu:function(e){
				var that = this ;
				this.kit.get("/admin/globalData", {}, function(res) {
					that.admin = res.admin;
					that.menuList = res.menuList;
					getApp().globalData.menuList = res.menuList ;
					getApp().globalData.admin = res.admin ;
					for (var i = 0; i < that.menuList.length; i++) {
						var cur = that.menuList[i];
						if (cur.type != 2) {
							continue ;
						}
						var url = cur.pages ;
						if ( !!url && url.indexOf("pages") > -1) {
							uni.redirectTo({
								url: url
							});
							return false ;
						}
					}
					
					that.loading = false ;
					
					uni.showModal({
						title:'提示',
						content:'请先联系管理员分配权限',
						showCancel:false,
						confirmColor:'#5d83f7',
						success : function(e){
							
						}
					});
					
				});	
			}
		}
	}
</script>
